body {
    background: #121212;
    color: #ffffff;
    font-family: Arial, sans-serif;
    margin: 0;
}

body:has(.search-form):not(:has(.container)) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
}

body:has(.search-form):not(:has(.container)) .search-wrapper {
    width: 100%;
    max-width: 720px;
    padding: 0 20px;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    box-sizing: border-box;
}

body:has(.search-form) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

body:has(.search-form) .search-wrapper {
    padding: 0;
}

.search-header {
    margin-bottom: 32px;
}

.back-link {
    display: inline-block;
    color: #8b8b8b;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #ffffff;
}

.search-header .search-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.search-form {
    width: 100%;
    max-width: 720px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1e1e1e;
    border: 1px solid #2f2f2f;
    border-radius: 22px;
    padding: 12px 14px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 8px 30px rgba(0, 0, 0, 0.45);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.search-type-toggle {
    display: flex;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
    background: #2b2b2b;
}

.toggle-segment {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #8b8b8b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.toggle-segment:hover:not(.toggle-segment--active) {
    background: #353535;
    color: #ffffff;
}

.toggle-segment--active {
    background: #e53935;
    color: #ffffff;
}

.toggle-segment--active[data-type="tv"] {
    background: #1e88e5;
}

.search-form:focus-within {
    border-color: #4a4a4a;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 10px 35px rgba(0, 0, 0, 0.55);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 16px;
    padding: 10px 6px;
}

.search-input::placeholder {
    color: #8b8b8b;
}

.search-button {
    background: #2b2b2b;
    color: white;
    border: 1px solid #3a3a3a;
    border-radius: 14px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.search-button:hover {
    background: #353535;
    border-color: #4a4a4a;
}

.search-button:active {
    transform: scale(0.98);
}

.results-heading {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 24px 0;
    color: #ffffff;
}

.results-range {
    font-size: 14px;
    font-weight: 400;
    color: #8b8b8b;
    margin-left: 12px;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.movie-card {
    position: relative;
    display: flex;
    gap: 16px;
    background: #1e1e1e;
    border: 1px solid #2f2f2f;
    border-radius: 16px;
    padding: 16px;
    transition: border-color 0.2s ease, transform 0.15s ease;
    overflow: hidden;
}

.movie-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 16px;
}

.movie-card a:not(.movie-card-link) {
    position: relative;
    z-index: 2;
}

.movie-card:hover {
    border-color: #4a4a4a;
    transform: translateY(-2px);
}

.movie-poster {
    flex-shrink: 0;
    display: block;
    width: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: #2b2b2b;
    text-decoration: none;
}

.movie-title a {
    color: inherit;
    text-decoration: none;
}

.movie-title a:hover {
    text-decoration: underline;
}

.movie-poster img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: contain;
}

.movie-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.movie-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    line-height: 1.3;
}

.movie-overview {
    font-size: 13px;
    color: #b0b0b0;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-meta {
    margin-top: auto;
}

.movie-date {
    font-size: 12px;
    color: #6b6b6b;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-text {
    font-size: 18px;
    color: #8b8b8b;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 24px;
}

.page-btn,
.page-indicator {
    font-size: 14px;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 14px;
    line-height: 1;
}

.page-btn {
    display: inline-block;
    text-decoration: none;
    border: 1px solid #3a3a3a;
    transition: background 0.2s ease, border-color 0.2s ease;
}

a.page-btn {
    color: #ffffff;
    background: #2b2b2b;
    cursor: pointer;
}

a.page-btn:hover {
    background: #353535;
    border-color: #4a4a4a;
}

.page-btn--disabled {
    color: #4a4a4a;
    background: #1a1a1a;
    border-color: #2a2a2a;
    cursor: default;
}

.page-indicator {
    color: #8b8b8b;
    background: #1e1e1e;
    border: 1px solid #2f2f2f;
    white-space: nowrap;
}

body:has(.error-container) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.error-container {
    text-align: center;
    padding: 48px 40px;
    background: #1e1e1e;
    border: 1px solid #2f2f2f;
    border-radius: 22px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 8px 30px rgba(0, 0, 0, 0.45);
    max-width: 520px;
    width: 90%;
    box-sizing: border-box;
}

.error-code {
    font-size: 72px;
    font-weight: 800;
    color: #e53935;
    margin: 0 0 8px 0;
    line-height: 1;
    letter-spacing: -2px;
}

.error-divider {
    width: 60px;
    height: 3px;
    background: #e53935;
    border-radius: 2px;
    margin: 16px auto;
}

.error-title {
    font-size: 18px;
    color: #b0b0b0;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.error-description {
    font-size: 14px;
    color: #6b6b6b;
    margin: 0 0 32px 0;
    line-height: 1.5;
}

.error-link {
    display: inline-block;
    color: #ffffff;
    background: #2b2b2b;
    border: 1px solid #3a3a3a;
    border-radius: 14px;
    padding: 12px 28px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.error-link:hover {
    background: #353535;
    border-color: #4a4a4a;
}

.error-link:active {
    transform: scale(0.98);
}

.eps-panel {
    background: #1e1e1e;
    border: 1px solid #2f2f2f;
    border-radius: 16px;
    padding: 24px;
}

.eps-panel__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.eps-panel__head h3 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.eps-count {
    font-size: 13px;
    color: #8b8b8b;
    font-weight: 600;
}

.season-rail {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.season-rail__label {
    font-size: 13px;
    font-weight: 600;
    color: #8b8b8b;
    flex-shrink: 0;
}

.season-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.season-pill {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    background: #162440;
    color: #5b9bd5;
    border: 1px solid #1e3a5f;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.season-pill:hover {
    background: #1e3a5f;
    color: #a8d4f0;
    border-color: #2a5a8a;
}

.season-pill.is-active {
    background: #1e88e5;
    color: #ffffff;
    border-color: #1e88e5;
}

.server-rail {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.server-rail__label {
    font-size: 13px;
    font-weight: 600;
    color: #8b8b8b;
    flex-shrink: 0;
}

.server-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.server-pill {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    background: #401616;
    color: #d55b5b;
    border: 1px solid #5f1e1e;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.server-pill:hover {
    background: #5f1e1e;
    color: #f0a8a8;
    border-color: #8a2a2a;
}

.server-pill.is-active {
    background: #e53935;
    color: #ffffff;
    border-color: #e53935;
}

.ep-rail {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ep-rail__label {
    font-size: 13px;
    font-weight: 600;
    color: #8b8b8b;
    flex-shrink: 0;
}

.ep-rail__sub {
    font-size: 12px;
    font-weight: 600;
    color: #5b9bd5;
}

.ep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.ep-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 6px;
    border-radius: 10px;
    text-decoration: none;
    background: #1a2e1e;
    color: #66bb6a;
    border: 1px solid #2e5e3e;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.ep-tile__num {
    font-size: 15px;
    font-weight: 700;
}

.ep-tile__name {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ep-tile:hover {
    background: #2e5e3e;
    color: #a5d6a7;
    border-color: #43a047;
}

.ep-tile.is-current {
    background: #43a047;
    color: #ffffff;
    border-color: #43a047;
    box-shadow: 0 0 0 2px rgba(67, 160, 71, 0.35);
}

.ep-tile.coming {
    background: #1e1e1e;
    color: #4a4a4a;
    border-color: #2f2f2f;
}

.ep-tile.coming:hover {
    background: #2b2b2b;
    color: #6b6b6b;
    border-color: #3a3a3a;
}

.ep-tile__chk {
    font-size: 11px;
    color: #a5d6a7;
}

.ep-tile.is-current .ep-tile__chk {
    color: #ffffff;
}

.eps-legend {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #8b8b8b;
    align-items: center;
}

.eps-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lg-now,
.lg-chk,
.lg-coming {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.lg-now {
    background: #43a047;
    box-shadow: 0 0 0 2px rgba(67, 160, 71, 0.35);
}

.lg-chk {
    background: #66bb6a;
}

.lg-coming {
    background: #4a4a4a;
}

@media (max-width: 768px) {
    .movies-grid {
        grid-template-columns: 1fr;
    }

    .eps-panel {
        padding: 18px;
    }

    .ep-grid {
        grid-template-columns: repeat(auto-fill, minmax(117px, 1fr));
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px 12px 40px;
    }

    .results-heading {
        font-size: 18px;
    }

    .movie-card {
        padding: 12px;
    }

    .movie-poster {
        width: 80px;
    }

    .movie-poster img {
        height: 120px;
    }

    .error-container {
        padding: 36px 24px;
    }

    .error-code {
        font-size: 52px;
    }

    .error-title {
        font-size: 15px;
    }

    .page-btn,
    .page-indicator {
        padding: 8px 14px;
        font-size: 13px;
    }
}

.movie-detail {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-top: 16px;
}

.movie-detail__main {
    display: flex;
    gap: 28px;
}

.movie-detail__poster {
    flex-shrink: 0;
    width: 280px;
    border-radius: 16px;
    overflow: hidden;
    background: #1e1e1e;
    border: 1px solid #2f2f2f;
}

.movie-detail__poster img {
    display: block;
    width: 100%;
    height: auto;
}

.movie-detail__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.movie-detail__title {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    color: #ffffff;
    line-height: 1.2;
}

.movie-detail__meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.movie-detail__date {
    font-size: 14px;
    color: #8b8b8b;
}

.movie-detail__section {
    margin-top: 8px;
}

.movie-detail__section-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
}

.movie-detail__overview {
    font-size: 15px;
    color: #b0b0b0;
    line-height: 1.7;
    margin: 0;
}

.player-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.player-controls select {
    background: #1e1e1e;
    color: #ffffff;
    border: 1px solid #2f2f2f;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.player-controls select:hover,
.player-controls select:focus {
    border-color: #4a4a4a;
}

.movie-detail__player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #000000;
    border: 1px solid #2f2f2f;
}

.movie-detail__player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 768px) {
    .movie-detail__main {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .movie-detail__poster {
        width: 220px;
    }

    .movie-detail__title {
        font-size: 22px;
        text-align: center;
    }

    .movie-detail__meta {
        justify-content: center;
    }

    .movie-detail__section-title {
        font-size: 15px;
    }

    .movie-detail__overview {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .movie-detail__poster {
        width: 180px;
    }

    .movie-detail__title {
        font-size: 18px;
    }

    .movie-detail__player {
        border-radius: 12px;
    }

    .player-controls {
        flex-direction: column;
        gap: 8px;
    }

    .eps-panel {
        padding: 14px;
    }

    .ep-grid {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
        gap: 5px;
    }

    .ep-tile {
        padding: 8px 4px;
    }

    .ep-tile__num {
        font-size: 13px;
    }

    .ep-tile__name {
        font-size: 10px;
    }

    .season-pill,
    .server-pill {
        padding: 5px 12px;
        font-size: 12px;
    }

    .eps-legend {
        flex-wrap: wrap;
        gap: 12px;
    }
}